<!DOCTYPE html>
<html><head>
<title>Homework of Week 3</title>




<meta charset="utf-8">
<meta name="X-UA-Compatible" content="IE=edge">
<meta name="google-site-verification" content="">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
<meta content="telephone=no" name="format-detection">
<meta name="description" content="">
<meta name="renderer" content="webkit">
<meta name="theme-color" content="#ffffff">



<meta property="og:title" content="Homework of Week 3" />
<meta property="og:description" content="用二进制表示数值    Problem Solution Overflow Accuracy Error     int8_t x = 67 01000011 No No   int8_t y = -7 11111001 No No   int8_t z = y - x 10110110 No No       Problem Solution Overflow Accuracy Error     int8_t x = 0xd3 11010011 Yes No   uint8_t = 0xd3 11010011 No No       Problem Solution Overflow Accuracy Error     int8_t x = 127 01111111 No No   int8_t y = -7 11111001 No No   int8_t z = y - x 01111010 Yes No       Problem Solution Overflow Accuracy Error     float x = 1." />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://wondrouswisdomcard.gitee.io/posts/homework3/" />
<meta property="article:published_time" content="2020-09-21T00:00:00+00:00" />
<meta property="article:modified_time" content="2020-09-21T00:00:00+00:00" /><meta property="og:site_name" content="My Blog" />





<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="Homework of Week 3"/>
<meta name="twitter:description" content="用二进制表示数值    Problem Solution Overflow Accuracy Error     int8_t x = 67 01000011 No No   int8_t y = -7 11111001 No No   int8_t z = y - x 10110110 No No       Problem Solution Overflow Accuracy Error     int8_t x = 0xd3 11010011 Yes No   uint8_t = 0xd3 11010011 No No       Problem Solution Overflow Accuracy Error     int8_t x = 127 01111111 No No   int8_t y = -7 11111001 No No   int8_t z = y - x 01111010 Yes No       Problem Solution Overflow Accuracy Error     float x = 1."/>







<script src="/vendor/js/jquery.min.js" ></script>
<script src="/vendor/js/popper.min.js" ></script>
<script src="/vendor/js/bootstrap.min.js" ></script>
<script src="/vendor/js/smooth-scroll.polyfills.min.js" ></script>
<link type="text/css" rel="stylesheet" href="/vendor/css/bootstrap.min.css">
<script src="/vendor/js/vue.min.js" ></script>






<link rel="stylesheet" href="https://wondrouswisdomcard.gitee.io/scss/journal.min.c116bc90d171283f099f173854157ec8f183f9073b93443b2c8ad82899ee9025.css" integrity="sha256-wRa8kNFxKD8Jnxc4VBV&#43;yPGD&#43;Qc7k0Q7LIrYKJnukCU=" media="screen">



<link rel="stylesheet" href="https://wondrouswisdomcard.gitee.io/scss/dark-mode.min.552aae4638a84aa57cf0b195750a49ea9131d3bb621d1ed3ebc9b14b18166536.css" integrity="sha256-VSquRjioSqV88LGVdQpJ6pEx07tiHR7T68mxSxgWZTY=" media="screen">


<script src="https://wondrouswisdomcard.gitee.io/js/loadCSS.js"></script>
<script>
  loadCSS("https://fonts.googleapis.com/css?family=Lora|Montserrat|Fira+Mono|Noto+Serif+SC|Material+Icons");
</script>




  
    <script src="https://wondrouswisdomcard.gitee.io/js/toc-collapse.js"></script>
  



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">
<script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>
<script src="/vendor/js/md5.min.js"></script>
<script>
  var gitalk = new Gitalk({
  clientID: 'your client id',
  clientSecret: 'your client secret',
  repo: 'repo name',
  owner: 'user',
  admin: ['user'],
  id: md5(location.pathname),
  distractionFreeMode: 'false'
  });
  window.onload = function () {
        gitalk.render('gitalk-container')
  }
</script>







<script src="https://cdn.jsdelivr.net/npm/vue-disqus@3/dist/vue-disqus.js"></script>


</head>
<body>
    	<div id="app"><div ref="sideContainer" class="side-container">
    
    <a class="a-block nav-head false" href="https://wondrouswisdomcard.gitee.io">
    
        <div class="nav-title">
            Wondrous WindomCard&#39;s Blog
        </div>
        
        <div class="nav-subtitle">
            Themed by Diary.
        </div>
        
    </a>

    <div class="nav-link-list">
        
        
            
            
            
                
            
            
            
            <a class="a-block nav-link-item active" href="/posts">
                Archive
            </a>
            
        
            
            
            
            
            
            <a class="a-block nav-link-item false" href="/categories">
                Categories
            </a>
            
        
            
            
            
            
            
            <a class="a-block nav-link-item false" href="/tags">
                Tags
            </a>
            
        
            
            
            
            
            
            <a class="a-block nav-link-item false" href="/index.xml">
                RSS Feed
            </a>
            
        
    </div>

    

    <div class="nav-footer">
        
Hugo Theme <a href="https://github.com/amazingrise/hugo-theme-diary">Diary</a> by <a href="https://amazingrise.net">Rise</a>
<br>
Ported from <a href="https://mak1t0.cc/" target="_blank" rel="noreferrer noopener">Makito</a>'s <a href="https://github.com/SumiMakito/hexo-theme-journal/" target="_blank" rel="noreferrer noopener">Journal.</a> <br>
<br>

&copy;
	
	This is a customized copyright.
	

    </div>
    
</div><div ref="extraContainer" class="extra-container">
    
    
    <div class="toc animated-visibility" :class="{ invisible: scrollY <= 140 }">


	<div class="toc-content">
	
		
		
		
		<center>- CATALOG -</center>
		
		
		<ul>
			
				
				
					
						
						
						
						
							
								<ul class="collapse" data-toggle="collapse">
							
						
						
							<li>
								<a href="#%e7%94%a8%e4%ba%8c%e8%bf%9b%e5%88%b6%e8%a1%a8%e7%a4%ba%e6%95%b0%e5%80%bc" onclick="onNavClick(`#用二进制表示数值-nav`)" id="用二进制表示数值-nav">
									用二进制表示数值
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
						
							<li>
								<a href="#%e5%90%8d%e8%af%8d%e8%a7%a3%e9%87%8a" onclick="onNavClick(`#名词解释-nav`)" id="名词解释-nav">
									名词解释
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
							
								<ul class="collapse" data-toggle="collapse">
							
						
						
							<li>
								<a href="#method-of-complements" onclick="onNavClick(`#method-of-complements-nav`)" id="method-of-complements-nav">
									Method Of Complements
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
						
							<li>
								<a href="#byte" onclick="onNavClick(`#byte-nav`)" id="byte-nav">
									Byte
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
						
							<li>
								<a href="#integer" onclick="onNavClick(`#integer-nav`)" id="integer-nav">
									Integer
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
						
							<li>
								<a href="#floating-point" onclick="onNavClick(`#floating-point-nav`)" id="floating-point-nav">
									Floating Point
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
							
								</ul>
							
						
						
						
							<li>
								<a href="#%e8%af%81%e6%98%8e" onclick="onNavClick(`#证明-nav`)" id="证明-nav">
									证明
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
							
								<ul class="collapse" data-toggle="collapse">
							
								<ul class="collapse" data-toggle="collapse">
							
						
						
							<li>
								<a href="#1%e8%af%81%e6%98%8e%e4%ba%8c%e8%bf%9b%e5%88%b6%e8%b4%9f%e6%95%b0%e7%9a%84%e8%a1%a5%e7%a0%81%e7%ad%89%e4%ba%8e%e5%af%b9%e5%ba%94%e6%ad%a3%e6%95%b0%e7%9a%84%e5%8f%8d%e7%a0%81%e5%8a%a0%e4%b8%80" onclick="onNavClick(`#1证明二进制负数的补码等于对应正数的反码加一-nav`)" id="1证明二进制负数的补码等于对应正数的反码加一-nav">
									1）证明二进制负数的补码等于对应正数的反码加一
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
						
							<li>
								<a href="#2int8_t-x---017%e7%94%a88%e8%bf%9b%e5%88%b6%e6%8f%8f%e8%bf%b0%e5%8f%98%e9%87%8fx" onclick="onNavClick(`#2int8_t-x---017用8进制描述变量x-nav`)" id="2int8_t-x---017用8进制描述变量x-nav">
									2）Int8_t x = -017，用8进制描述变量X
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
						
							<li>
								<a href="#3int8_t-x---0x1f-int-y--x-%e7%94%a816%e8%bf%9b%e5%88%b6%e8%a1%a8%e7%a4%bax%e5%92%8cy%e5%b9%b6%e8%af%b4%e6%98%8e%e8%ae%a1%e7%ae%97%e8%bf%87%e7%a8%8b" onclick="onNavClick(`#3int8_t-x---0x1f-int-y--x-用16进制表示x和y并说明计算过程-nav`)" id="3int8_t-x---0x1f-int-y--x-用16进制表示x和y并说明计算过程-nav">
									3）Int8_t x = -0x1f; int y = x; 用16进制表示x和y,并说明计算过程
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
						
							<li>
								<a href="#4%e8%af%81%e6%98%8e%e7%ac%ac%e4%b8%89%e9%97%ae%e9%97%ae%e4%bb%80%e4%b9%88%e5%8f%af%e4%bb%a5%e8%bf%99%e6%a0%b7%e7%ae%97%e7%ac%a6%e5%8f%b7%e4%bd%8d%e6%89%a9%e5%b1%95%e7%9a%84%e6%ad%a3%e7%a1%ae%e6%80%a7" onclick="onNavClick(`#4证明第三问问什么可以这样算符号位扩展的正确性-nav`)" id="4证明第三问问什么可以这样算符号位扩展的正确性-nav">
									4）证明第三问问什么可以这样算，（符号位扩展的正确性）
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
						
							<li>
								<a href="#5nan%e7%9a%84%e5%90%ab%e4%b9%89" onclick="onNavClick(`#5nan的含义-nav`)" id="5nan的含义-nav">
									5）NaN的含义
								</a>
							</li>
						
						
					
				
			
		</ul>
	</div>

</div>
    
    <div class="pagination">
        <a id="globalBackToTop" class="pagination-action animated-visibility" href="#top" :class="{ invisible: scrollY == 0 }">
            <i class="material-icons pagination-action-icon">
                keyboard_arrow_up
            </i>
        </a>
        
        <a class="pagination-action" v-on:click="toggleDarkMode">
            <i class="material-icons pagination-action-icon" v-if="isDarkMode">
                brightness_4
            </i>
            <i class="material-icons pagination-action-icon" v-else="isDarkMode">
                brightness_7
            </i>
        </a>
        
        
    </div>
</div>
<div class="single-column-drawer-container" ref="drawer"
     v-bind:class="{ 'single-column-drawer-container-active': isDrawerOpen }">
    <div class="drawer-content">
        <div class="drawer-menu">
            
            
            
                
                
                
                    
                
                
                
                <a class="a-block drawer-menu-item active" href="/posts">
                    Archive
                </a>
                
            
                
                
                
                
                
                <a class="a-block drawer-menu-item false" href="/categories">
                    Categories
                </a>
                
            
                
                
                
                
                
                <a class="a-block drawer-menu-item false" href="/tags">
                    Tags
                </a>
                
            
                
                
                
                
                
                <a class="a-block drawer-menu-item false" href="/index.xml">
                    RSS Feed
                </a>
                
            
            
            <div class="toc">


	<div class="toc-content">
	
		
		
		
		<center>- CATALOG -</center>
		
		
		<ul>
			
				
				
					
						
						
						
						
							
								<ul class="collapse" data-toggle="collapse">
							
						
						
							<li>
								<a href="#%e7%94%a8%e4%ba%8c%e8%bf%9b%e5%88%b6%e8%a1%a8%e7%a4%ba%e6%95%b0%e5%80%bc" onclick="onNavClick(`#用二进制表示数值-nav`)" id="用二进制表示数值-nav">
									用二进制表示数值
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
						
							<li>
								<a href="#%e5%90%8d%e8%af%8d%e8%a7%a3%e9%87%8a" onclick="onNavClick(`#名词解释-nav`)" id="名词解释-nav">
									名词解释
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
							
								<ul class="collapse" data-toggle="collapse">
							
						
						
							<li>
								<a href="#method-of-complements" onclick="onNavClick(`#method-of-complements-nav`)" id="method-of-complements-nav">
									Method Of Complements
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
						
							<li>
								<a href="#byte" onclick="onNavClick(`#byte-nav`)" id="byte-nav">
									Byte
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
						
							<li>
								<a href="#integer" onclick="onNavClick(`#integer-nav`)" id="integer-nav">
									Integer
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
						
							<li>
								<a href="#floating-point" onclick="onNavClick(`#floating-point-nav`)" id="floating-point-nav">
									Floating Point
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
							
								</ul>
							
						
						
						
							<li>
								<a href="#%e8%af%81%e6%98%8e" onclick="onNavClick(`#证明-nav`)" id="证明-nav">
									证明
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
							
								<ul class="collapse" data-toggle="collapse">
							
								<ul class="collapse" data-toggle="collapse">
							
						
						
							<li>
								<a href="#1%e8%af%81%e6%98%8e%e4%ba%8c%e8%bf%9b%e5%88%b6%e8%b4%9f%e6%95%b0%e7%9a%84%e8%a1%a5%e7%a0%81%e7%ad%89%e4%ba%8e%e5%af%b9%e5%ba%94%e6%ad%a3%e6%95%b0%e7%9a%84%e5%8f%8d%e7%a0%81%e5%8a%a0%e4%b8%80" onclick="onNavClick(`#1证明二进制负数的补码等于对应正数的反码加一-nav`)" id="1证明二进制负数的补码等于对应正数的反码加一-nav">
									1）证明二进制负数的补码等于对应正数的反码加一
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
						
							<li>
								<a href="#2int8_t-x---017%e7%94%a88%e8%bf%9b%e5%88%b6%e6%8f%8f%e8%bf%b0%e5%8f%98%e9%87%8fx" onclick="onNavClick(`#2int8_t-x---017用8进制描述变量x-nav`)" id="2int8_t-x---017用8进制描述变量x-nav">
									2）Int8_t x = -017，用8进制描述变量X
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
						
							<li>
								<a href="#3int8_t-x---0x1f-int-y--x-%e7%94%a816%e8%bf%9b%e5%88%b6%e8%a1%a8%e7%a4%bax%e5%92%8cy%e5%b9%b6%e8%af%b4%e6%98%8e%e8%ae%a1%e7%ae%97%e8%bf%87%e7%a8%8b" onclick="onNavClick(`#3int8_t-x---0x1f-int-y--x-用16进制表示x和y并说明计算过程-nav`)" id="3int8_t-x---0x1f-int-y--x-用16进制表示x和y并说明计算过程-nav">
									3）Int8_t x = -0x1f; int y = x; 用16进制表示x和y,并说明计算过程
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
						
							<li>
								<a href="#4%e8%af%81%e6%98%8e%e7%ac%ac%e4%b8%89%e9%97%ae%e9%97%ae%e4%bb%80%e4%b9%88%e5%8f%af%e4%bb%a5%e8%bf%99%e6%a0%b7%e7%ae%97%e7%ac%a6%e5%8f%b7%e4%bd%8d%e6%89%a9%e5%b1%95%e7%9a%84%e6%ad%a3%e7%a1%ae%e6%80%a7" onclick="onNavClick(`#4证明第三问问什么可以这样算符号位扩展的正确性-nav`)" id="4证明第三问问什么可以这样算符号位扩展的正确性-nav">
									4）证明第三问问什么可以这样算，（符号位扩展的正确性）
								</a>
							</li>
						
						
					
				
			
				
				
					
						
						
						
						
						
							<li>
								<a href="#5nan%e7%9a%84%e5%90%ab%e4%b9%89" onclick="onNavClick(`#5nan的含义-nav`)" id="5nan的含义-nav">
									5）NaN的含义
								</a>
							</li>
						
						
					
				
			
		</ul>
	</div>

</div>
            
        </div>
    </div>
</div>
<transition name="fade">
    <div v-bind:class="{ 'single-column-drawer-mask': mounted }" v-if="isDrawerOpen" v-on:click="toggleDrawer"></div>
</transition>
<nav ref="navBar" class="navbar sticky-top navbar-light single-column-nav-container">
    <div ref="navBackground" class="nav-background"></div>
    <div class="container container-narrow nav-content">
        <button id="nav_dropdown_btn" class="nav-dropdown-toggle" type="button" v-on:click="toggleDrawer">
            <i class="material-icons">
                menu
            </i>
        </button>
        <a ref="navTitle" class="navbar-brand" href="https://wondrouswisdomcard.gitee.io">
            Wondrous WindomCard&#39;s Blog
        </a>
        
        <button type="button" class="nav-darkmode-toggle" v-on:click="toggleDarkMode">
            <i class="material-icons" v-if="isDarkMode">
                brightness_4
            </i>
            <i class="material-icons" v-else="isDarkMode">
                brightness_7
            </i>
        </button>
        
    </div>
</nav>
<div class="single-column-header-container" ref="pageHead"
     v-bind:style="{ transform: 'translateZ(0px) translateY('+.3*scrollY+'px)', opacity: 1-navOpacity }">
    <a href="https://wondrouswisdomcard.gitee.io">
        <div class="single-column-header-title">Wondrous WindomCard&#39;s Blog</div>
        
        <div class="single-column-header-subtitle">Themed by Diary.</div>
        

    </a>
</div>

            <div id="content">
<div ref="streamContainer" class="stream-container">
    <div class="post-list-container post-list-container-shadow">
        <div class="post">
            
            
            

            <div class="post-head-wrapper-text-only"
                
            >
                <div class="post-title">
                    Homework of Week 3
                    
                    <div class="post-meta">
                        
                        <time itemprop="datePublished">
                            2020-09-21 00:00
                        </time>
                        

                        
                            <i class="material-icons" style="">folder</i>
                                <a href="/categories/">[Homework]</a>
                                &nbsp;
                        

                        
                            <i class="material-icons" style="">label</i>
                            
                                <a href="/tags/data-representation">Data Representation</a>
                                &nbsp;
                            
                        
                        
                    </div>
                </div>
            </div>
            
            <div class="post-body-wrapper">
                
                <div class="post-body" v-pre>
                
                    <h2 id="用二进制表示数值">用二进制表示数值</h2>
<table>
<thead>
<tr>
<th align="center">Problem</th>
<th align="center">Solution</th>
<th align="center">Overflow</th>
<th align="center">Accuracy Error</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">int8_t x = 67</td>
<td align="center">01000011</td>
<td align="center">No</td>
<td align="center">No</td>
</tr>
<tr>
<td align="center">int8_t y = -7</td>
<td align="center">11111001</td>
<td align="center">No</td>
<td align="center">No</td>
</tr>
<tr>
<td align="center">int8_t z = y - x</td>
<td align="center">10110110</td>
<td align="center">No</td>
<td align="center">No</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th align="center">Problem</th>
<th align="center">Solution</th>
<th align="center">Overflow</th>
<th align="center">Accuracy Error</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">int8_t x = 0xd3</td>
<td align="center">11010011</td>
<td align="center">Yes</td>
<td align="center">No</td>
</tr>
<tr>
<td align="center">uint8_t = 0xd3</td>
<td align="center">11010011</td>
<td align="center">No</td>
<td align="center">No</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th align="center">Problem</th>
<th align="center">Solution</th>
<th align="center">Overflow</th>
<th align="center">Accuracy Error</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">int8_t x = 127</td>
<td align="center">01111111</td>
<td align="center">No</td>
<td align="center">No</td>
</tr>
<tr>
<td align="center">int8_t y = -7</td>
<td align="center">11111001</td>
<td align="center">No</td>
<td align="center">No</td>
</tr>
<tr>
<td align="center">int8_t z = y - x</td>
<td align="center">01111010</td>
<td align="center">Yes</td>
<td align="center">No</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th align="center">Problem</th>
<th align="center">Solution</th>
<th align="center">Overflow</th>
<th align="center">Accuracy Error</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">float x = 1.125</td>
<td align="center">0 01111111 00100000000000000000000</td>
<td align="center">No</td>
<td align="center">No</td>
</tr>
<tr>
<td align="center">float x = 23.0</td>
<td align="center">0 10000011 01110000000000000000000</td>
<td align="center">No</td>
<td align="center">No</td>
</tr>
<tr>
<td align="center">float x = 0.45</td>
<td align="center">0 01111101 11001100110011001100110</td>
<td align="center">No</td>
<td align="center">Yes</td>
</tr>
</tbody>
</table>
<hr>
<h2 id="名词解释">名词解释</h2>
<h3 id="method-of-complements">Method Of Complements</h3>
<p>In mathematics and computing, the method of complements is a technique used to subtract one number from another using only addition of positive numbers. This method was commonly used in mechanical calculators and is still used in modern computers.
<strong>The nines&rsquo; complement</strong>  of a number is formed <strong>by replacing each digit with nine minus that digit</strong>. To subtract a decimal number y (the subtrahend) from another number x (the minuend) two methods may be used:
In the first method <strong>the nines&rsquo; complement of x is added to y</strong>. Then the nines&rsquo; complement of the result obtained is formed to produce the desired result.
In the second method <strong>the nines&rsquo; complement of y is added to x and one is added to the sum</strong>. The leading digit &lsquo;1&rsquo; of the result is then discarded. Discarding the initial &lsquo;1&rsquo; is especially convenient on calculators or computers that use a fixed number of digits: there is nowhere for it to go so it is simply lost during the calculation. The nines&rsquo; complement plus one is known as the tens&rsquo; complement.
The method of complements can be extended to other number bases (radices); in particular, <strong>it is used on most digital computers to perform subtraction, represent negative numbers in base 2 or binary arithmetic and test underflow and overflow in calculation.</strong></p>
<h3 id="byte">Byte</h3>
<p>The byte is a unit of digital information that most commonly <strong>consists of eight bits</strong>. Historically, the byte (symbol B) was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable unit of memory in many computer architectures.</p>
<h3 id="integer">Integer</h3>
<p>In computer science, an integer is a datum of integral data type, a data type that represents some finite subset of the mathematical integers. Integral data types may be of different sizes and may or may not be allowed to contain negative values. Integers are commonly represented in a computer as a group of binary digits (bits). The size of the grouping varies so the set of integer sizes available varies between different types of computers. Computer hardware, including virtual machines, nearly always provide a way to represent a processor register or memory address as an integer.</p>
<h3 id="floating-point">Floating Point</h3>
<p>In computing, floating point is the formulaic representation that approximates a real number so as to support a trade-off between range and precision. A number is, in general, represented approximately to a fixed number of significant digits (the significand) and scaled using an exponent in some fixed base; the base for the scaling is normally two, ten, or sixteen. A number that can be represented exactly is of the following form:</p>
<p>$$
significand \times base ^{exponment}
$$</p>
<p>where significand is an integer (i.e., in Z), base is an integer greater than or equal to two, and exponent is also an integer.</p>
<hr>
<h2 id="证明">证明</h2>
<h6 id="对使用latex编译出的进行了截图">对使用Latex编译出的进行了截图</h6>
<h4 id="1证明二进制负数的补码等于对应正数的反码加一">1）证明二进制负数的补码等于对应正数的反码加一</h4>
<p><img src="../../images/homework3/1.jpg" alt="1"></p>
<h4 id="2int8_t-x---017用8进制描述变量x">2）Int8_t x = -017，用8进制描述变量X</h4>
<p><img src="../../images/homework3/2.jpg" alt="2"></p>
<h4 id="3int8_t-x---0x1f-int-y--x-用16进制表示x和y并说明计算过程">3）Int8_t x = -0x1f; int y = x; 用16进制表示x和y,并说明计算过程</h4>
<p><img src="../../images/homework3/3.jpg" alt="3"></p>
<h4 id="4证明第三问问什么可以这样算符号位扩展的正确性">4）证明第三问问什么可以这样算，（符号位扩展的正确性）</h4>
<p><img src="../../images/homework3/4(1).jpg" alt="4(1)"></p>
<p><img src="../../images/homework3/4(2).jpg" alt="4(2)"></p>
<h4 id="5nan的含义">5）NaN的含义</h4>
<p>NaN (&ldquo;Not a Number&rdquo;) An IEEE floating point representation for the result of a numerical operation which cannot return a valid number value. A NaN can result from multiplying an infinity by a zero, or from subtracting one infinity from another NaN is encoded as a special bit pattern which would otherwise represent a floating-point number.</p>

                    
                    <HR width="100%" id="EOF">
		    <p style="color:#777;">Last modified on 2020-09-21</p>
                    
                </div>
            </div>
            
            
            <nav class="post-pagination">

                
                <a class="newer-posts" href="https://wondrouswisdomcard.gitee.io/posts/homework4/">
			Next<br>Homework of Week 4
                </a>
                
                
                
                <a class="older-posts" href="https://wondrouswisdomcard.gitee.io/posts/homework2/">
			Previous<br>Homework of Week 2
                </a>
                
            </nav>
            <div class="post-comment-wrapper">
                
<div class="comments">
    <vue-disqus shortname="Your disqus short name."></vue-disqus>
</div>
<noscript><noscript>Please activate JavaScript to view comments.</noscript></noscript>
<a href="https://disqus.com/" class="dsq-brlink">Comments powered by <span class="logo-disqus">Disqus</span></a>



<div id="gitalk-container"></div>






            </div>
        </div>
    </div>
</div>

            </div><div id="single-column-footer">
Hugo Theme <a href="https://github.com/amazingrise/hugo-theme-diary">Diary</a> by <a href="https://amazingrise.net">Rise</a>
<br>
Ported from <a href="https://mak1t0.cc/" target="_blank" rel="noreferrer noopener">Makito</a>'s <a href="https://github.com/SumiMakito/hexo-theme-journal/" target="_blank" rel="noreferrer noopener">Journal.</a> <br>
<br>

&copy;
	
	This is a customized copyright.
	
</div>
            </div>
    <script>
let app;

app = new Vue({
    el: '#app',
    data: {
        scrollY: 0,
        navOpacity: 0,
        isDrawerOpen: false,
        mounted: false,
        isDarkMode: false
    },
    methods: {
            sgn(t, x) {
                let k = 1. / (1. - 2 * t);
                if (x <= t) return 0;
                else if (x >= 1 - t) return 1;
                else {
                    return k * (x - t);
                }
            },
            handleScroll() {
                this.scrollY = window.scrollY;
                this.navOpacity = this.sgn(.0, Math.min(1, Math.max(0, window.scrollY / (this.pageHeadHeight() - this.navBarHeight() * 0.8))));
                const {navBar, navBackground, navTitle, extraContainer, streamContainer} = this.$refs;

                if (this.navOpacity >= 1) {
                    navBackground.style.opacity = 1;
                    navTitle.style.opacity = 1;
                } else {
                    navBackground.style.opacity = 0;
                    navTitle.style.opacity = 0;
                }
            },
            handleResize() {
                const {navBar, navBackground, navTitle, extraContainer, streamContainer} = this.$refs;
                extraContainer.style.left = (streamContainer.offsetWidth - extraContainer.offsetWidth) + 'px';
            },
            navBarHeight() {
                return this.$refs.navBar.offsetHeight;
            },
            pageHeadHeight() {
                return this.$refs.pageHead.offsetHeight;
            },
            toggleDrawer() {
                this.isDrawerOpen = !this.isDrawerOpen;
                document.getElementsByTagName('html')[0].style.overflow = this.isDrawerOpen ? 'hidden' : 'unset';
            },
            closeDrawer() {
                this.isDrawerOpen = false;
                document.getElementsByTagName('html')[0].style.overflow = this.isDrawerOpen ? 'hidden' : 'unset';
            },
            toggleDarkMode() {
                this.isDarkMode = !this.isDarkMode;
                if (this.isDarkMode==true){
                    document.cookie = "night=1;path=/";
                    document.body.classList.add("night");
                } else {
                    document.cookie = "night=0;path=/";
                    document.body.classList.remove("night");
                }
            }
    },
    created() {
        window.addEventListener('scroll', this.handleScroll);
        window.addEventListener('resize', this.handleResize);
        window._nonDesktop = function () {
            let check = false;
            (function (a) {
                if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true;
            })(navigator.userAgent || navigator.vendor || window.opera);
            return check;
        };
        
        var night = document.cookie.replace(/(?:(?:^|.*;\s*)night\s*\=\s*([^;]*).*$)|^.*$/, "$1");
        if (night==""){
            if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
                
            }
        }else{
            
            if (night=="1") {
                this.toggleDarkMode();
            }
        }
    },
    mounted() {
        this.handleScroll();
        this.handleResize();
        this.mounted = true;

        
    },
    destroyed() {
        window.removeEventListener('scroll', this.handleScroll);
        window.removeEventListener('resize', this.handleResize);
    }
});
</script>

<script src="https://wondrouswisdomcard.gitee.io/js/journal.js"></script>
    </body>
</html>
